package com.blb.zycommunity.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blb.zycommunity.entity.ZyCommunityInteraction;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blb.zycommunity.entity.ZyComplaintSuggest;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 社区互动表 Mapper 接口
 * </p>
 *
 * @author chenheng
 * @since 2023-11-20
 */
public interface ZyCommunityInteractionMapper extends BaseMapper<ZyCommunityInteraction> {

    IPage<ZyCommunityInteraction> selectCommunityInteractionPage(IPage<ZyCommunityInteraction> page, String ownerNickname, String ownerRealName, String ownerPhoneNumber, String communityId);

    List<ZyCommunityInteraction> selectCommunityInteractions(String communityId);

    @Update("update zy_community_interaction set del_flag = '2' where interaction_id = #{interactionId}")
    void deleteInteractionById(String interactionId);

    @Update("update zy_community_interaction set like_num = like_num + 1 where interaction_id = #{interactionId}")
    void addLikeNum(String interactionId);

    @Update("update zy_community_interaction set like_num = like_num - 1 where interaction_id = #{interactionId}")
    void deleteLikeNum(String interactionId);

}
